#! /usr/bin/env python

def readfile(filename):
    f = open(filename,'r')
    num = 2900;
    total_hour = []
    data = []
    index = 0
    for line in f:
        #print line
        index += 1 
        # split_list = line.split(';')
        # if (len(split_list) >= 2): 
        #     v_data = float(split_list[-1].strip())
        #     hour = split_list[1].strip()
        #     if hour not in total_hour:
        #         print hour
        #         total_hour.append(hour)
        #         print line
        #     if(v_data >= 60 or v_data <= -60):
        #         print"=============="
        #         print v_data
        #         print line
        #         print "=============="
        #     data.append(v_data)
        #     num -= 1
        #     if (num == 0):
        #         print line
        #         break
    f.close()
    print index
    return data
def writedata(data_list, datafile):
    f = open(datafile,'w')
    for data in data_list:
        f.write(str(data))
        f.write(' ')
    f.close()
    
def getpartfile(filename_src, filename_des):
   f_r = open(filename_src, 'r')
   f_w = open(filename_des, 'w')
   num = 1000
   f_r.seek(1000)
   for line in f_r:
      f_w.write(line)
      num -=1
      if (num == 0):
         print line
         break
   f_r.close()
   f_w.close()


writedata(readfile('1.txt'),'22.mat')
       
